﻿using System;
using System.Globalization;
using System.Text;

/*
 * Write a program that reads a date and time given in the format: day.month.year
 * hour:minute:second and prints the date and time after 6 hours and 30 minutes
 * (in the same format) along with the day of week in Bulgarian.
 */

namespace CurrentDateAfterSixHours
{
    class CurrentDateAfterSixHours
    {
        static DateTime ParseDate(string input)
        {
            StringBuilder number = new StringBuilder();
            //[0] = Day, [1] = Month, [2] = Year, [3] = Hour, [4] = Minute, [5] = second
            int[] date = new int[6];
            int dateIndex = 0;

            //Search Year, mounth and day in the string
            for (int charIndex = 0, length = input.Length; charIndex < length; charIndex++)
            {
                if (char.IsDigit(input[charIndex]))
                {
                    number.Append(input[charIndex]);
                }
                else
                {
                    if (number.Length > 0)
                    {
                        date[dateIndex++] = int.Parse(number.ToString());
                        number.Clear();
                    }
                }
            }

            if (number.Length > 0)
            {
                date[dateIndex] = int.Parse(number.ToString());
            }

            return new DateTime(date[2], date[1], date[0], date[3], date[4], date[5]);
        }

        static DateTime AfterSixHours(DateTime date)
        {
            return date.AddHours(6.5);
        }

        static void Main()
        {
            Console.WriteLine("Enter a date in format: day.month.year hour:minute:second");
            string input = Console.ReadLine();

            DateTime date = ParseDate(input);
            date = AfterSixHours(date);

            Console.WriteLine("{0} {1}", date.ToString("dddd", new CultureInfo("bg-BG")), date);
        }
    }
}
